1 <?php
2     require(
"../includes/config.php");
3     session_start();
4     $currentDate = date(
'Y-m-d');
5     
if(isset($_SESSION['manufacturer_login'])) {
6         
if(isset($_SESSION['manufacturer_login']) == true) {
7             $order_id = $_GET[
'id'];
8             $querySelectDistributor =
"SELECT dist_id,dist_name FROM distributor";
9             $resultDistributor = mysqli_query($con,$querySelectDistributor);
10             $query_selectOrderItems =
"SELECT *,order_items.quantity AS q FROM orders,order_items,products WHERE order_items.order_id='$order_id' AND order_items.pro_id=products.pro_id AND order_items.order_id=orders.order_id";
11             $result_selectOrderItems = mysqli_query($con,$query_selectOrderItems);
12             $query_selectOrder =
"SELECT date,status FROM orders WHERE order_id='$order_id'";
13             $result_selectOrder = mysqli_query($con,$query_selectOrder);
14             $row_selectOrder = mysqli_fetch_array($result_selectOrder);
15             $query_selectInvoiceId =
"SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='scm_new' AND TABLE_NAME='invoice'";
16             $result_selectInvoiceId = mysqli_query($con,$query_selectInvoiceId);
17             $row_selectInvoiceId = mysqli_fetch_array($result_selectInvoiceId);
18         }
19         
else {
20             header(
'Location:../index.php');
21         }
22     }
23     
else {
24         header(
'Location:../index.php');
25     }
26 ?>
27
28 <!DOCTYPE html>
29 <html>
30 <head>
31     <title> View Orders </title>
32     <link rel=
"stylesheet" href="../includes/main_style.css" >
33 </head>
34 <body>
35     <?php
36         include(
"../includes/header.inc.php");
37         include(
"../includes/nav_manufacturer.inc.php");
38         include(
"../includes/aside_manufacturer.inc.php");
39     ?>
40     <section>
41         <h1>Invoice Summary</h1>
42         <table
class="table_infoFormat">
43         <tr>
44             <td> Invoice No: </td>
45             <td> <?php echo $row_selectInvoiceId[
'AUTO_INCREMENT']; ?> </td>
46         </tr>
47         <tr>
48             <td> Invoice Date: </td>
49             <td> <?php echo date(
'd-m-Y'); ?> </td>
50         </tr>
51         <tr>
52             <td> Order No: </td>
53             <td> <?php echo $order_id; ?> </td>
54         </tr>
55         <tr>
56             <td> Order Date: </td>
57             <td> <?php echo date(
"d-m-Y",strtotime($row_selectOrder['date'])); ?> </td>
58         </tr>
59         </table>
60         <form action=
"insert_invoice.php" method="POST" class="form">
61         <input type=
"hidden" name="order_id" value="<?php echo $order_id; ?>" />
62         <table
class="table_invoiceFormat">
63             <tr>
64                 <th> Products </th>
65                 <th> Unit Price </th>
66                 <th> Quantity </th>
67                 <th> Amount </th>
68             </tr>
69             <?php $i=
1; while($row_selectOrderItems = mysqli_fetch_array($result_selectOrderItems)) { ?>
70             <tr>
71                 <td> <?php echo $row_selectOrderItems[
'pro_name']; ?> </td>
72                 <td> <?php echo $row_selectOrderItems[
'pro_price']; ?> </td>
73                 <td> <?php echo $row_selectOrderItems[
'q']; ?> </td>
74                 <td> <?php echo $row_selectOrderItems[
'q']*$row_selectOrderItems['pro_price']; ?> </td>
75             </tr>
76             <?php $i++; } ?>
77             <tr style=
"height:40px;vertical-align:bottom;">
78                 <td colspan=
"3" style="text-align:right;"> Grand Total: </td>
79                 <td>
80                 <?php
81                     mysqli_data_seek($result_selectOrderItems,
0);
82                     $row_selectOrderItems = mysqli_fetch_array($result_selectOrderItems);
83                     echo $row_selectOrderItems[
'total_amount'];
84                 ?>
85                 </td>
86             </tr>
87         </table>
88             <br/>
89             Ship via: &nbsp;&nbsp;&nbsp;&nbsp;<
select name="distributor">
90                 <option
value="" disabled selected>--- Select Distributor ---</option>
91                 <?php
while($rowSelectDistributor = mysqli_fetch_array($resultDistributor)) { ?>
92                 <option
value="<?php echo $rowSelectDistributor['dist_id']; ?>"> <?php echo $rowSelectDistributor['dist_name']; ?> </option>
93                 <?php } ?>
94             </
select> <br/>
95             <br/>
96             comments: <textarea maxlength=
"400" name="txtComment" rows="5" cols="30"></textarea>
97             <br/>
98             <input type=
"submit" value="Generate Invoice" class="submit_button" />
99             <span
class="error_message">
100             <?php
101                 
if(isset($_SESSION['error'])) {
102                     echo $_SESSION[
'error'];
103                     unset($_SESSION[
'error']);
104                 }
105             ?>
106             </span>
107         </form>
108     </section>
109     <?php
110         include(
"../includes/footer.inc.php");
111     ?>
112 </body>
113 </html>


Gõ tìm kiếm nhanh...